<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>临时事项申请列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css" />
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">

    <style>
        .table > tbody > tr > td {
            height: 48px;
            max-height: 44px;
            overflow: hidden;
        }

        .table > tbody > tr > td span {
            max-height: 44px;
            line-height: 22px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
        }

        .saveModle {
            width: 500px;
            height: 300px;
            position: fixed;
            top: 50%;
            left: 50%;
            margin-left: -250px;
            margin-top: -150px;
            background: #fff;
            border-radius: 10px;
            z-index: 1978;
            display: none;
            border: 1px solid #cfcfcf;
        }

        .saveModle .top {
            height: 34px;
            line-height: 34px;
            font-size: 14px;
            font-weight: bold;
            color: #333;
            padding-left: 7px;
            border-bottom: 1px solid #cfcfcf;
            background: #fff;
        }

        .saveModle .top .title {
            height: 32px;
            line-height: 32px;
            font-size: 14px;
            font-weight: bold;
            color: #333;
            float: left;
            background: #fff;
        }

        .saveModle .top .btn {
            font-size: 20px;
            width: 34px;
            height: 22px;
            line-height: 12px;
            display: inline-block;
            float: right;
        }

        .saveModle .top .btn:hover {
            color: red;
        }

        .saveModle .saveBtn {
            margin: 0 auto;
            margin-top: 35px;
            display: block;

        }
        .fixed-table_body tr td {
            border-right: none;
            font-size: 12px;
            text-align: center;
            height: 48px;
            max-height: 44px;
            overflow: hidden;
        }

        .fixed-table_header tr th {
            border-right: none;
            background: yellow;
            font-weight: normal;
            font-size: 12px;
        }
        .fixed-table_body tr:nth-of-type(odd){
            background: #F9F9F9;
        }

        span.lineOne {
            /*line-height: 28px !important;*/
            /*height: 28px;*/
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
        }
        .content {
            padding: 8px 8px 0 8px;
        }

        /*#tbList tr:nth-child(odd){*/
        /*background-color:#ECFAFD;*/
        /*}*/
    </style>
</head>

<body>
<section class="content" id="app">
    <div class="div-td-content-more"><i></i></div>
    <div style="height: 25px;margin-bottom: 10px;">
        <div class="pull-left" style="width: 120px;">
            <select id="selectCompany" class="form-control" style="width: 100%;height: 25px;font-size: 12px;line-height: 25px;padding-top: 0px;padding-bottom: 0px;padding-left: 6px;" v-model="searchParams.selectCom"  >
                <option value="">请选择公司</option>
                <option v-for="item in companyList" v-bind:value="item.id">{{item.name}}</option>
            </select>
        </div>
        <div class="pull-left" style="width:120px;margin-left:10px;">
            <select v-model="searchParams.type" class="form-control"
                    style="height:25px;font-size:12px;line-height:25px;padding-top:0px;padding-bottom:0px;padding-left:6px;">
                <option v-for="(item,i) in typeList" v-bind:value="item.value">{{item.name}}
                </option>
            </select>
        </div>
        <div class="pull-left" style="width:120px;margin-left:10px;">
            <select v-model="searchParams.auditFlag" class="form-control"
                    style="height:25px;font-size:12px;line-height:25px;padding-top:0px;padding-bottom:0px;padding-left:6px;">
                <option v-for="(item,i) in auditFlagList" v-bind:value="item.value">{{item.name}}
                </option>
            </select>
        </div>
        <input class="form-control pull-left input-sm" type="text" @keyup.enter="search"
               placeholder="申请人"
               style="width: 120px;margin-left: 10px;"
               v-model="searchParams.createUserName"/>
        <input class="form-control pull-left input-sm" type="text" @keyup.enter="search"
               placeholder="关键字"
               style="width: 120px;margin-left: 10px;"
               v-model="searchParams.key"/>
        <button type="button" class="btn oaBtn btn-sm" @keyup.enter="search" @click="search"
                style="margin-left: 10px;">
            查询
        </button>
        <button type="button" v-if="showBtn('addApply')" class="btn oaBtn pull-right btn-sm"
                style="margin-right: 20px"
                @click="gotoDetail(0,'edit',1)"/>
        新增申请</button>

        <div class="clearfix"></div>
        <!-- /.box-tools -->
    </div>
    <div class="box-body no-padding iframeH3" style="overflow: auto;" id="scrollDiv">
        <div id="progress" class="wyui-progress"></div>
        <div class="fixed-table-box head-fixed ">
            <div class="fixed-table_header-wraper">
                <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                    <tr>
                        <th style="width:20px;">
                            <div class="table-cells">
                            <input type="checkbox" id="checkAll" v-model="isCheckedAll"
                                   v-if="pageType=='pay'"/>
                            </div>
                        </th>
                        <th style="width:120px;"><div class="table-cells">公司</div></th>
                        <th style="width: 100px;"><div class="table-cells">事项类别</div></th>
                        <th style="width: 60px;"><div class="table-cells">申请人</div></th>
                        <th><div class="table-cells">详细描述</div></th>
                        <th style="width: 140px;"><div class="table-cells">申请日期</div></th>
                        <th style="width: 90px;"><div class="table-cells">当前状态</div></th>
                        <th style="width: 120px;"><div class="table-cells">操作</div></th>
                        <th style="width: 17px;"><div class="table-cells"></div></th>
                    </tr>
                    </thead>
                </table>
            </div>
            <div class="fixed-table_body-wraper iframeFixedTmp" >
                <table class="fixed-table_body table-hover" cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
                    <tbody id="tbList">
                    <tr v-for="(item,i) in list">
                        <td style="width:20px;">
                            <input type="checkbox" enabled="isEnable(item)" v-model="item.checked"/>
                        </td>
                        <td style="width:120px;">{{item.orgName.split('-')[0]}}</td>
                        <td style="width:100px;">{{item.type}}</td>
                        <td style="width:60px;">{{item.createUserName}}</td>
                        <td style="text-align:left;"><span class="lineOne">{{item.description}}</span></td>
                        <td style="width:140px;">{{formatDate(item.createTime)}}</td>
                        <td v-html="convertAuditFlagToName(item)" style="width:90px;">
                        </td>
                        <td style="width:120px;">
                            <a href="javascript:void(0);" v-if="showABtn(item,'edit')"
                               @click="gotoDetail(item.id,'edit',0)">&nbsp;编辑&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'copier')"
                               @click="getCopier(item.id)" style="display: block;">&nbsp;修改抄送人&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'edit')"
                               @click="removeById(item.id,i)">&nbsp;删除&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'browser')"
                               @click="gotoDetail(item.id,'browser',0)">&nbsp;查看&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'audit')"
                               @click="gotoDetail(item.id,'applyAudit',0)">&nbsp;审核&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'pay')"
                               @click="gotoDetail(item.id,'pay',0)"
                               style="color:red;">&nbsp;付款&nbsp;</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <!--<table class="table table-hover text-center table-striped">-->
            <!--<thead>-->
            <!--<tr>-->
                <!--<th style="width:20px;">-->
                    <!--<input type="checkbox" id="checkAll" v-model="isCheckedAll"-->
                           <!--v-if="pageType=='pay'"/>-->
                <!--</th>-->
                <!--<th style="min-width: 80px;width:120px;">公司</th>-->
                <!--<th style="width: 100px;">事项类别</th>-->
                <!--<th style="width: 60px;">申请人</th>-->
                <!--<th>事项主题</th>-->
                <!--<th style="width: 140px;">申请日期</th>-->
                <!--<th style="min-width: 80px;">当前状态</th>-->
                <!--<th style="width: 120px;">操作</th>-->
            <!--</tr>-->
            <!--</thead>-->
            <!--<tbody id="tbList">-->
            <!--<tr v-for="(item,i) in list">-->
                <!--<td style="width:20px;"><input type="checkbox" enabled="isEnable(item)"-->
                                               <!--v-model="item.checked"/>-->
                <!--</td>-->
                <!--<td>{{item.orgName.split('-')[0]}}</td>-->
                <!--<td>{{item.type}}</td>-->
                <!--<td>{{item.createUserName}}</td>-->
                <!--<td style="text-align:left;"><span>{{item.title}}</span></td>-->
                <!--<td>{{formatDate(item.createTime)}}</td>-->
                <!--<td v-html="convertAuditFlagToName(item)">-->
                <!--</td>-->
                <!--<td>-->
                    <!--<a href="javascript:void(0);" v-if="showABtn(item,'edit')"-->
                       <!--@click="gotoDetail(item.id,'edit',0)">&nbsp;编辑&nbsp;</a>-->
                    <!--<a href="javascript:void(0);" v-if="showABtn(item,'copier')"-->
                       <!--@click="getCopier(item.id)" style="display: block;">&nbsp;修改抄送人&nbsp;</a>-->
                    <!--<a href="javascript:void(0);" v-if="showABtn(item,'edit')"-->
                       <!--@click="removeById(item.id,i)">&nbsp;删除&nbsp;</a>-->
                    <!--<a href="javascript:void(0);" v-if="showABtn(item,'browser')"-->
                       <!--@click="gotoDetail(item.id,'browser',0)">&nbsp;查看&nbsp;</a>-->
                    <!--<a href="javascript:void(0);" v-if="showABtn(item,'audit')"-->
                       <!--@click="gotoDetail(item.id,'applyAudit',0)">&nbsp;审核&nbsp;</a>-->
                    <!--<a href="javascript:void(0);" v-if="showABtn(item,'pay')"-->
                       <!--@click="gotoDetail(item.id,'pay',0)"-->
                       <!--style="color:red;">&nbsp;付款&nbsp;</a>-->
                <!--</td>-->
            <!--</tr>-->
            <!--</tbody>-->
        <!--</table>-->

    </div>
    <div class="oa-pager text-center" style="margin-top: 5px;">
        共
        <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
        <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
        <span class="oa-pager-button" id="first">首页</span>
        <span class="oa-pager-button" id="prev">上一页</span>
        <span class="oa-pager-button" id="next">下一页</span>
        <span class="oa-pager-button" id="last">尾页</span>
    </div>
    <div class="saveModle">
        <div class="top">
            <div class="title">选择人员</div>
            <div class="btn" v-on:click="closeModle"> x</div>
        </div>
        <div id="header" class="header box-body" style="padding: 25px 20px;padding-bottom: 0;">
            <div class="form-group">
                <label for="txtCopier" id="aCopiers" tabindex="-1">抄送人</label>
                <div class="userbox form-control" id="copiers"
                     v-on:click.stop="inputFocus('txtCopier')">
                    <div v-for="(user,i) in tmpevent.copiers" class="user"
                         v-bind:class="{ select: copierSelectedIdx == i }"
                         v-on:click="selectUser(i,'copierSelectedIdx')">{{user.copyPersonName}};
                    </div>
                    <input type="text" id="txtCopier"
                           @keyup.delete="deleteUser('copiers','copierSelectedIdx',$event)"/>
                </div>
            </div>
        </div>
        <input type="button" value="保存" class="saveBtn btn oaBtn" @click="saveGo">
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/plugins/fixedTable/fixed-table.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    function refresh() {
        var that = this;
        $.wyui.page.getByPage();
        //临时事项红点提示
        top.getRedHot();
    }

    var app = new Vue({
        el: '#app',
        data: {
            auditFlagList: [
                {value: '', name: '审核状态'},
                {value: '-1', name: '未提交'},
                {value: '0', name: '审核中'},
                {value: '1', name: '已通过'},
                {value: '2', name: '已驳回'}
            ],
            typeList: [
                {name: '事项类型', value: ''},
//                {name: '商务条件申请', value: '商务条件申请'}
            ],
            companyList: [],
            searchParams: {
                selectCom: "",
                userId: getCurrentUser().id,
                type: '',
                auditFlag: '',
                createUserName: '',
                key: ''
            },
            pageType: "apply",//apply:临时事项申请
            isCheckedAll: false,
            currentUser: getCurrentUser(),
            list: [],
            rightOpENames: [],
            copierSelectedIdx: -1,
            tmpevent: {
                main: {
                    id: ''
                },
                copiers: []
            }

        },
        watch: {
            isCheckedAll: function (val) {
                for (var i = 0; i < this.list.length; i++) {
                    var item = this.list[i];
                    item.checked = this.isCheckedAll;
                }
            }
        },
        methods: {
            isEnable: function (item) {
                return true;
            },
            closeModle: function () {
                $(".saveModle").hide();
            },
            inputFocus: function (id) {
                $("#" + id).focus();
            },
            selectUser: function (i, prop) {
                this.copierSelectedIdx = -1;
                this[prop] = i;
            },
            unselectUser: function () {
                this.copierSelectedIdx = -1;
            },
            deleteUser: function (prop, idx, event) {
                if (event.keyCode == 46 || event.keyCode == 8 && event.target.value == "") {
                    if (this[idx] > -1) {
                        this.tmpevent[prop].splice(this[idx], 1);
                        this.copierSelectedIdx = -1;
                    } else {
                        this[idx] = this.tmpevent[prop].length - 1;
                    }
                }
            },
            payAudit: function (auditFlag) {
                var ids = new Array();
                for (var i = 0; i < this.list.length; i++) {
                    if (this.list[i].checked && this.list[i].auditFlag == '3' && this.list[i].currentAuditorId == getCurrentUser().id) {
                        ids.push(this.list[i].id);
                    } else {
                        this.list[i].checked = false;
                    }
                }
                if (ids.length == 0) {
                    alert("请选择要提交的付款记录");
                    return;
                }
                $.wyui.postMethod(urlConfig.apply.tmpevent.payAudit, {
                    ids: ids.join(','),
                    userId: getCurrentUser().id,
                    auditFlag: auditFlag
                }, function () {
                    alert("审核成功");
                    $.wyui.page.getByPage();
                });
            },
            submitPay: function () {
                var ids = new Array();
                for (var i = 0; i < this.list.length; i++) {
                    if (this.list[i].checked && this.list[i].auditFlag == '1') {
                        ids.push(this.list[i].id);
                    } else {
                        this.list[i].checked = false;
                    }
                }
                if (ids.length == 0) {
                    alert("请选择要提交的付款记录");
                    return;
                }
                $.dialog({
                    content: 'url:configPayAuditor.html?ids=' + ids.join(',') + '&t=' + new Date(),
                    title: '配置付款审核人',
                    width: 600,
                    height: 300,
                    max: false,
                    min: false,
                    lock: true
                });
            },
            convertAuditFlagToName: function (item) {
                //auditFlag:-1,0,1,2
                switch (item.auditFlag) {
                    case "-1":
                        return "未提交";
                        break;
                    case "0":
                        if (item.currentAuditorId == getCurrentUser().id) {
                            return "<span style='color:red;'>待-" + item.currentAuditorName + "-审核</span>";
                        } else {
                            return "待-"+item.currentAuditorName + "-审核";
                        }
                        break;
                    case "1":
                        return "已通过";
                        break;
                    case "2":
                        return "已驳回";
                        break;
                    default :
                        break;
                }
            },
            showABtn: function (item, btnName) {
                switch (btnName) {
                    case 'browser':
                        switch (item.auditFlag) {
                            case '-1':
                                return false;
                                break;
                            case '0':
                                return currentUser.id != item.currentAuditorId;
                                break;
                            case '1':
                            case '2':
                                return true;
                                break;
                        }
                        return true;
                        break;
                    case 'edit':
                        return (item.auditFlag == '-1' || item.auditFlag == '2') && item.createUserId == currentUser.id;
                        break;
                    case 'audit':
                        return item.auditFlag == '0' && currentUser.id == item.currentAuditorId;
                        break;
                    case 'copier':
                        console.log(item.createUserId, getCurrentUser().id)
                        return item.createUserId == getCurrentUser().id;
                    default:
                        break;
                }
            },
            showBtn: function (btnName) {
                switch (btnName) {
                    case "addApply":
                        return true;
                        break;
                    default:
                        break;
                }
            },
            formatDate: function (now) {
//                return  NewDate(now).Format(TimeFormat.middle)
                return new Date(now).Format(TimeFormat.pcList);
            },
            gotoDetail: function (id, pageType, isAdd) {
                if (pageType == 'edit' && isAdd == 1) {
                    for (var i = 0; i < this.list.length; i++) {
                        if (this.list[i].checked && this.list[i].createUserId == getCurrentUser().id) {
                            id = this.list[i].id;
                            break;
                        }
                    }
                }
                top.$.dialog({
                    content: 'url:/page/apply/tmpevent/detail.html?id=' + id + '&pageType=' + pageType + "&isAdd=" + isAdd + "&t=" + new Date(),
                    title: isAdd == "1" ? '新增申请' : "详情",
                    width: 904,
                    height: 535,
                    max: true,
                    min: true,
                    lock: true
                });
            },
            search: function () {
                var that = this;
                var data = {
                    'companyId': that.searchParams.selectCom,
                    'auditFlag': that.searchParams.auditFlag,
                    'key':that.searchParams.key,
                    'type':that.searchParams.type,
                    'createUserName':that.searchParams.createUserName,
                    'userId': that.searchParams.userId
                };
                $.wyui.page.queryParams.requestPage = 1;
               /* $.extend($.wyui.page.queryParams, this.searchParams);*/
                $.extend($.wyui.page.queryParams, data);
                console.log($.wyui.page.queryParams);
                $.wyui.page.getByPage();
            },
            removeById: function (id, i) {
                if (confirm('确认要删除吗？')) {
                    var that = this;
                    $.wyui.postMethod(urlConfig.apply.tmpevent.removeById, {id: id}, function (result) {
                        that.list.splice(i, 1);
                    });
                }
            },
            getCopier: function (id) {
                var that = this;
                that.tmpevent.main.id = id;
                $.wyui.postMethod(urlConfig.apply.copier.eventCopier, {eventId: id}, function (result) {
                    console.log(result);
                    that.tmpevent.copiers = result;
                    $(".saveModle").show();
                });

            },
            saveGo: function () {
                var that = this;
                console.log(that.copiers);
                $.wyui.postMethod(urlConfig.apply.copier.eventSave, that.tmpevent, function (r) {
                    alert("保存成功");
                    $(".saveModle").hide();
                    $.wyui.page.getByPage();
                })

            }
        },
        mounted: function () {
            var that = this;
            this.pageType = $.wyui.page.urlParams.pageType;
            $.wyui.postMethod(urlConfig.system.rightOp.getRightOpByUserId, {userId: getCurrentUser().id}, function (rightOps) {
                for (var i = 0; i < rightOps.length; i++) {
                    that.rightOpENames.push(rightOps[i].eName);
                }
            });
            $.wyui.postMethod("/company/getCompanyListByUserIdAndRegionId.json", {userId:getCurrentUser().id}, function (r) {
                console.log(r);
                that.companyList=r;
            });
            this.auditFlagList = [
                {value: '', name: '状态'},
                {value: '-1', name: '未提交'},
                {value: '0', name: '审核中'},
                {value: '1', name: '已通过'},
                {value: '2', name: '已驳回'},
            ];
            //获取临时事项类型
            $.wyui.postMethod("/aplType/getNameList.json", {modelName:'tmpevent'}, function (r) {
                for (var i=0;i<r.names.length;i++) {
                    var o = {
                        "value": r.names[i].name,
                        "name": r.names[i].name
                    }
                    that.typeList.push(o)
                }
            });
        }
    });

    $.wyui.page.dataUrl = server.ip + urlConfig.apply.tmpevent.getByPage;
    $.wyui.page.queryParams.pageType = $.wyui.page.urlParams.pageType;
    $.extend($.wyui.page.queryParams, app.searchParams);
    $.wyui.page.getByPage_callback = function (records) {
        app.list = records;
        document.getElementById("scrollDiv").scrollTop = 0;
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        }
    };

    $(function () {
        $(".saveModle").show();
        $("#txtCopier").autoComplete({
            url: server.ip + urlConfig.system.user.getTop10ByNameUser,
            render: function (users, panel) {
                for (var i = 0; i < users.length; i++) {
                    $("<li></li>").data("autoComplete",
                        users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                var copierIds = new Array();
                for (var i = 0; i < app.tmpevent.copiers.length; i++) {
                    copierIds.push(app.tmpevent.copiers[i].copyPersonId);
                }
                if ($.inArray(user.id, copierIds) > -1) {
                    alert("收件人或抄送人重复");
                    $(this).val("");
                    return false;
                } else {
                    app.tmpevent.copiers.push({copyPersonId: user.id, copyPersonName: user.name});
                    $(this).val("");
                    return false;
                }
            },
            height: 210,
            width: 320,
            top: 0,
            left: 0
        });
        $(".saveModle").hide();
    });
</script>
<script>
    /************************滚动加载******************************/
    var divscroll = document.getElementById('scrollDiv');

    function divScroll() {
        var wholeHeight = divscroll.scrollHeight;
        var scrollTop = divscroll.scrollTop;
        var divHeight = divscroll.clientHeight;
        console.log(scrollTop + divHeight, wholeHeight)
        if (scrollTop + divHeight >= wholeHeight - 2) {
//            alert('滚动到底部了！');
            if (isLoad) {
                isLoad = false;
                setTimeout($.wyui.page.getByPage("scroll"), 1000);

            }

            //这里写动态加载的逻辑，比如Ajax请求后端返回下一个页面的内容
        }

    }

    divscroll.onscroll = divScroll;
</script>
<script>
    //初始化FixedTable
    $(".fixed-table-box").fixedTable();
</script>
</body>
</html>